package com.fgi.springframework;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author HanXu
 * @date 2022/11/3
 **/
public class BeanFactory {

    public BeanFactory() {
    }

    /**
     *  bean 缓存
     */
    private Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<>();

    public Object getBean(String name) {
        return beanDefinitionMap.get(name).getBean();
    }

    public void registerBeanDefinition(String name, BeanDefinition beanDefinition) {
        beanDefinitionMap.put(name, beanDefinition);
    }
}
